/*
 * © Copyright 2011 Romain Marteau, Matthieu Totet
 * 
 *    This file is part of VineaToum.
 *
 *    VineaToum is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    VineaToum is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with VineaToum.  If not, see <http://www.gnu.org/licenses/>.
 *    
 */

package org.vineatoum.view.utils;

import javax.swing.JPanel;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

import javax.swing.JScrollPane;


public abstract class JPanelWrapper extends JPanel {
	private static final long serialVersionUID = -2472256906269559870L;
	protected JPanel mainPanel;
	
	/**
	 */
	public JPanelWrapper(JPanel _mainPanel){
		this.mainPanel = _mainPanel;
		setLayout(new BorderLayout());
		
		final JScrollPane scrollPane = new JScrollPane();
		add(scrollPane, BorderLayout.CENTER);
		scrollPane.setViewportView(mainPanel);
//		scrollPane.addComponentListener(new ComponentAdapter() {
//			@Override
//			public void componentResized(ComponentEvent e) {
//				// TODO Auto-generated method stub
//				super.componentResized(e);
//				System.out.println("resize");
//					mainPanel.setSize(new Dimension(
//							scrollPane.getWidth()-20, 
//							scrollPane.getHeight()-20));
//			}
//		});
//           
	}
}
